<?php

// Error if we don't have a Project ID and Crudset ID
//Incluce DB connect 
include_once "quickcrud_connect.php";
//include_once "commonctls.php";
include_once "CF_mysql_com.php";
//include_once "CF_all_com.php";

include_once "qc_functions.php";

if (empty($_REQUEST['crudset_id']) OR empty($_REQUEST['project_id']) ){

        $result = "First select Project and CRUDset";
		
		print $result;
		
        exit;
}

	$project_id = $_REQUEST['project_id'];
	$crudset_id = $_REQUEST['crudset_id'];
	
	
if($_REQUEST['sure'] == 'yes'){

	$crudset_name = lookup_value('cs_name','crudsets', "crudset_id = $crudset_id");

	do_query("DELETE FROM crudcols WHERE crudset_id = $crudset_id");
	do_query("DELETE FROM crudsets WHERE crudset_id = $crudset_id");
	echo "<p>Deleted CRUDset $crudset_name ($crudset_id)</p>\n";

}else{
	echo "<p>This will delete the crudset and column specificaitons for this set.  The variables and tablle and it's fields will remain in the Quickcrud system.</p>\n";

	echo "<p>Click <a href='delete_crudset.php?project_id=$project_id&crudset_id=$crudset_id$sure=yes>Here</a> to delete</p>\n";
	
}	
